﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Attributes
{
    //[Version("1.0.0","This is the first version")]
    class TestVersionAttribute
    {
        static void Main(string[] args)
        {
            VersionsInAction versionInActionInstance = new VersionsInAction();

            Type type = typeof(VersionsInAction);

            MethodInfo[] methodInfo = type.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);

            foreach (MethodInfo method in methodInfo)
            {
                object[] allAttributes = method.GetCustomAttributes(false);

                foreach (Attribute attribute in allAttributes)
                {
                    if (attribute is VersionAttribute)
                    {
                        VersionAttribute versionAttribute = attribute as VersionAttribute;
                        Console.WriteLine("Version: {0}\nComment: {1}", versionAttribute.Version, versionAttribute.Comment);
                    }
                }
            }
        }
    }
}
